# -*- coding: utf-8 -*-
# File : __init__.py.py
# Author: taoyahui
# Date : 2021/6/16
import logging
import os
import sys

sys.path.append('..')
from flask import Flask
from application_factory.extensions import scheduler
from application_factory.settings import DevelopmentConfig
from flask_sqlalchemy import SQLAlchemy

# db = SQLAlchemy()


def create_app():
    app = Flask(__name__)

    app.config.from_object(DevelopmentConfig)
    scheduler.init_app(app)

    # 初始化apscheduler
    # scheduler.init_app(app)
    scheduler.start()

    from .job import main as job_blueprint
    app.register_blueprint(job_blueprint, url_prefix='/v1/cron/job')
    import application_factory.web
    app.register_blueprint(web.web_bp, url_prefix='/web')
    return app


app = create_app()
app.config['JSON_AS_ASCII'] = False



